// 智慧建设-安全报告管理
import request from '@/utils/request'
import { BASE_URL } from '@/api/config.js'

// 新增项目信息
export function addProjectInfo(data) {
  return request({
    method: 'post',
    url: '/fillin/securityProject/addOrUpdate',
    data: data
  })
}

// 查询项目列表
export function queryProjectList(params) {
  return request({
    method: 'get',
    url: '/fillin/securityProject/query',
    params
  })
}

// 删除项目
export function deleteProjectInfo(pkid) {
  return request({
    method: 'delete',
    url: `/fillin/securityProject/delete?pkid=${pkid}`
  })
}

// 查询项目详情
export function queryProjectDetail(pkid) {
  return request({
    method: 'get',
    url: `/fillin/securityProject/get?pkid=${pkid}`
  })
}

// 查询可以安全报告的项目
export function queryReportProjectList(params) {
  return request({
    method: 'get',
    url: '/fillin/securityProject/queryProjectName',
    params
  })
}

// 获取问题列表
export function queryProblemList(params) {
  return request({
    method: 'get',
    url: '/fillin/security/query',
    params
  })
}

// 查询小类
export function queryTypeList(params) {
  return request({
    method: 'get',
    url: '/fillin/security/content/query/type',
    params
  })
}

// 新增问题
export function addProblemInfo(data) {
  return request({
    method: 'post',
    url: '/fillin/security/addOrUpdate',
    data: data
  })
}

// 删除问题
export function deleteProblemInfo(pkid) {
  return request({
    method: 'delete',
    url: `/fillin/security/delete?pkid=${pkid}`
  })
}

// 查询问题详情
export function queryProblemDetail(pkid) {
  return request({
    method: 'get',
    url: `/fillin/security/get?pkid=${pkid}`
  })
}

// 获取附件链接
export function securityFileUrl(pkid) {
  return `${
    process.env.NODE_ENV === 'production'
      ? BASE_URL
      : '/api'
  }/fillin/security/download?pkid=${pkid}`
}

// 新增条款
export function addContentInfo(data) {
  return request({
    method: 'post',
    url: '/fillin/security/content/addOrUpdate',
    data: data
  })
}

// 删除条款
export function deleteContentInfo(pkid) {
  return request({
    method: 'delete',
    url: `/fillin/security/content/delete?pkid=${pkid}`
  })
}

// 获取条款列表
export function queryContentList(params) {
  return request({
    method: 'get',
    url: '/fillin/security/content/query',
    params
  })
}

// 获取设备编号
export function queryProblemNoList(params) {
  return request({
    method: 'get',
    url: '/fillin/security/queryNo',
    params
  })
}

// 获取审核记录
export function queryCheckList(params) {
  return request({
    method: 'get',
    url: '/fillin/security/check/query',
    params
  })
}

// 审核
export function addCheckInfo(data) {
  return request({
    method: 'post',
    url: '/fillin/security/check/addOrUpdate',
    data: data
  })
}

// 获取统计
export function queryCounts(params) {
  return request({
    method: 'get',
    url: '/fillin/security/queryTotal',
    params
  })
}
